package leetcode.dp;

import java.util.Arrays;
import java.util.Scanner;

public class snake {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[][] p = process(n);
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n - i; j++) {
                System.out.print(p[i][j] + " ");
            }
            System.out.println();
        }
    }

    public static int[][] process(int n) {
        int[][] db = new int[n][n];

        for (int i = 0; i < n; i++) {
            db[i][0] = 1 + i * (i + 1) / 2;
        }
        for (int j = 1; j < n; j++) {
            for (int k = 0; k < n - 1; k++) {
                db[k][j] = db[k + 1][j - 1] + 1;
            }
        }
        return db;
    }

}
